package cn.lk1234.imt.utils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class SessionAttributeUtils {
	
	/**
	 * 根据name获取对应的session内容
	 */
	public static Object getSessionAttribute(HttpServletRequest request, String name) {
		HttpSession session = request.getSession();
		if (session != null) {
			return session.getAttribute(name);
		}
		return null;
	}

	/**
	 * 保存session内容
	 */
	public static void setSessionAttribute(HttpServletRequest request, String name, Object bindObject) {
		HttpSession session = request.getSession();
		session.setAttribute(name, bindObject);
	}

	/**
	 * 销毁name所对应的session内容
	 */
	public static void removeSessionAttribute(HttpServletRequest request, String name) {
		HttpSession session = request.getSession();
		session.removeAttribute(name);
	}
}
